﻿// changepwd.cpp: 实现文件
//

#include "pch.h"
#include "MFCdemo.h"
#include "changepwd.h"
#include "afxdialogex.h"


// changepwd 对话框

IMPLEMENT_DYNAMIC(changepwd, CDialogEx)

changepwd::changepwd(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG5, pParent)
{

}

changepwd::~changepwd()
{
}

void changepwd::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, user);
	DDX_Control(pDX, IDC_EDIT2, email);
	DDX_Control(pDX, IDC_EDIT3, npwd);
}


BEGIN_MESSAGE_MAP(changepwd, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &changepwd::OnBnClickedButton1)
END_MESSAGE_MAP()


// changepwd 消息处理程序


void changepwd::OnBnClickedButton1()
{
	wchar_t User[100]{ 0 };
	user.GetWindowTextW(User, 100);

	wchar_t Email[100]{ 0 };
	email.GetWindowTextW(Email, 100);

	wchar_t Npwd[100]{ 0 };
	npwd.GetWindowTextW(Npwd, 100);

	if (!sdk->UserChangepwd(string_convert::UnicodeToANSI(User),string_convert::UnicodeToANSI(Npwd),string_convert::UnicodeToANSI(Email)))
	{
		SHOW_MSG(sdk->error_msg.c_str());
		return;
	}
	SHOW_MSG(sdk->sucess_msg.c_str());
}
